package com.lightsaber.trade.as.entity.planning;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToOne;
import javax.persistence.Table;

import com.lightsaber.trade.as.entity.category.Category;
import com.lightsaber.trade.core.entity.BaseEntity;

@Entity
@Table(name = "MHPP_PLANNING")
public class Planning extends BaseEntity {

    private static final long serialVersionUID = 339529173121122L;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "CATEGORY_ID", updatable = false)
    private Category category;

    @Enumerated(EnumType.STRING)
    @Column(name = "PLANNING_LEVEL", nullable = false, length = 20)
    private PlanningLevel planningLevel;

    @Column(name = "ENDORSED_DATE", nullable = true)
    private Date endorsedDate;

    @Column(name = "IS_ARCHIVED_IMAGE", length = 10)
    private Boolean isArchivedImage;

    @Enumerated(EnumType.STRING)
    @Column(name = "status", nullable = false, length = 30)
    private PlanningStatus status;

    @OneToOne(mappedBy = "planning", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private Level2Planning level2Planning;

    @OneToOne(mappedBy = "planning", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private Level3Planning level3Planning;

    @OneToOne(mappedBy = "planning", cascade = CascadeType.ALL, fetch = FetchType.LAZY)
    private Level1Planning level1Planning;

    public Category getCategory() {
        return category;
    }

    public void setCategory(final Category category) {
        this.category = category;
    }

    public Date getEndorsedDate() {
        return endorsedDate;
    }

    public void setEndorsedDate(final Date endorsedDate) {
        this.endorsedDate = endorsedDate;
    }

    public Boolean getIsArchivedImage() {
        return isArchivedImage;
    }

    public void setIsArchivedImage(final Boolean isArchivedImage) {
        this.isArchivedImage = isArchivedImage;
    }

    public PlanningLevel getPlanningLevel() {
        return planningLevel;
    }

    public void setPlanningLevel(final PlanningLevel planningLevel) {
        this.planningLevel = planningLevel;
    }

    public PlanningStatus getStatus() {
        return status;
    }

    public void setStatus(final PlanningStatus status) {
        this.status = status;
    }

    public Level2Planning getLevel2Planning() {
        return level2Planning;
    }

    public void setLevel2Planning(final Level2Planning level2Planning) {
        this.level2Planning = level2Planning;
    }

    public Level3Planning getLevel3Planning() {
        return level3Planning;
    }

    public void setLevel3Planning(final Level3Planning level3Planning) {
        this.level3Planning = level3Planning;
    }

    public Level1Planning getLevel1Planning() {
        return level1Planning;
    }

    public void setLevel1Planning(final Level1Planning level1Planning) {
        this.level1Planning = level1Planning;
    }

}
